const koa = require('koa')
const mysql = require('koa-mysql')

let server = new koa()
let db = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '123456789',
  database: '20180709'
})

server.use(function *() {
  let data = yield db.query(`SELECT * FROM user_table`)
  this.body = data
})

server.listen(8080)
